not convinced that this is the best structure for sum but it beats everything else i've tried so there you go